package com.xhj.bigfactory.bigFactory.volatile0;

import static java.lang.System.out;
import static java.lang.Thread.currentThread;

/**
 * @author haijian xia 19110379031
 * @create 2021-07-24 19:14
 */
public class CompilerOptimization {
  public static void main(String[] args) {
    MyDataCO data = new MyDataCO();
    for (int i = 0; i < 30; i++) {
      new Thread(
              () -> {
                out.println(currentThread().getName() + " come in...");
                data.m();
              },
              "Thread" + i)
          .start();
    }
  }
}

class MyDataCO {
  int a;
  boolean boo;

  void m() {
    if (boo) {
      a = 1024;
      out.println("a=" + a);
    }
  }
}
